<#include
        "../common/com.html"  /> <@layout>
<head>
    <!-- page specific plugin styles -->
    <link rel="stylesheet" href="${ctx}/static/assets/css/ui.jqgrid.css" />
    <!-- ace styles -->
    <link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
    <script src="${ctx}/static/inc/platform/js/ajax.js"></script>
    <link rel="stylesheet" type="text/css" href="${ctx}/static/cbb/artDialog/skins/blue.css">
    <script src="${ctx}/static/cbb/artDialog/jquery.artDialog.js"></script>
</head>
<script>
   
</script>
<body>

<div class="page-content" style="overflow: hidden">

    <div class="row-fluid">
        <div class="span12">
            <form class="form-inline" id="myform">
                <input type="hidden" name="id" id="id">
                商品名称：<input type="text"  name="search_LIKE_wpmc" id="search_LIKE_wpmc"   class="query "  style="min-height: 24px;width: 140px"      />
                  &nbsp; &nbsp;
                商品编号：<input type="text"  name="search_LIKE_wpbh" id="search_LIKE_wpbh"   class="query "  style="min-height: 24px;width: 140px"      />
                  &nbsp; &nbsp;
                <button id="search_btn" onclick="return false;" class="btn btn-info btn-small"  onclick="queryModel()">
                    <i class="bigger-110"></i>
                    查询
                </button>
                <a href="#"  class="btn btn-danger btn-small bigger-110"   onclick="cleankhid();">取消 </a>

            </form>
            <!-- PAGE CONTENT BEGINS -->
            <table id="grid-table"></table>
            <div id="grid-pager"></div>
            <!-- PAGE CONTENT ENDS -->
        </div><!-- /.span -->
    </div><!-- /.row-fluid -->
</div><!-- /.page-content -->
<!-- page specific plugin scripts -->


<script src="${ctx}/static/assets/js/jqGrid/jquery.jqGrid.min.js"></script>
<script src="${ctx}/static/assets/js/jqGrid/i18n/grid.locale-cn.js"></script>
<script src="${ctx}/static/assets/js/markdown/markdown.min.js"></script>
<script src="${ctx}/static/assets/js/markdown/bootstrap-markdown.min.js"></script>

<script>
  
</script>
<script type="text/javascript">


$("#search_btn").click(function(){
	var wpbh= $("#search_LIKE_wpbh").val();
    var search_LIKE_wpmc=$("#search_LIKE_wpmc").val();

    $("#grid-table").jqGrid('setGridParam',{
        url:'${ctx}/cgglWp/query',
        datatype:'json',
        postData:{  'search_LIKE_wpmc':search_LIKE_wpmc, 'search_LIKE_wpbh':wpbh}, //发送数据
        page:1
    }).trigger("reloadGrid"); //重新载入
});


jQuery(function($) {
    // 获取编号

    //  jqgrid
    var grid_selector = "#grid-table";
    var pager_selector = "#grid-pager";
    var search_LIKE_wpmc=$("#search_LIKE_wpmc").val();


//    var orgid=$("#orgid").val();

    jQuery(grid_selector).jqGrid({
        datatype: "json", //将这里改为使用JSON数据
        mtype:"POST",
        postData:{  'search_LIKE_wpmc':search_LIKE_wpmc}, //发送数据
        url:'${ctx}/tj/queryjxctj',
        height: '60%',
        width:'80%',
        footerrow:false,  //合计数据
        colNames:[ '商品名称','商品编号','商品单位','库存数量','入库数量','出库数量','库存上限','库存下限','标记',''],
        colModel:[
            {name:'wpmc', width:150,sortable:false},
            {name:'wpbh', width:80,sortable:false},
//          {name:'lrdates',index:'',width:50,sortable:false},
            {name:'wpdw',index:'',width:50,sortable:false} ,
            {name:'kcsl',index:'',width:50,sortable:false} ,
            {name:'rksl',index:'',width:50,sortable:false} ,
            {name:'cksl',index:'',width:50,sortable:false} ,
            {name:'kcsx',index:'',width:50,sortable:false} ,
            {name:'kcxx',index:'',width:50,sortable:false} ,
     //       {name:'sptcfs',index:'',width:50,sortable:false,formatter:'select', editoptions:{value:"1:按比例;2:按件提成;"}} ,
            {name:'yxbz', width:150,sortable:false,formatter:'select', editoptions:{value:"0:停止销售 ;1:正常销售;2:打折销售;"}},
            {name:'id', hidden:true}
        ],
        rownumbers:true,//添加左侧行号
        sortname: 'id',
        sortable: false,
        viewrecords: true, //是否显示行数
        rowNum:30,
        rowList:[10,20,30],
        loadtext: '正在加载数据...',
        loadui : 'block',
        pager : pager_selector,
        altRows: true,
        shrinkToFit: true,

        loadComplete : function() {
            var table = this;
            setTimeout(function(){
                updatePagerIcons(table);
            },
                    0);
        } ,
//
        caption: "  " ,
        autowidth: true

    });




});

function updatePagerIcons(table) {
    var replacement =
    {
        'ui-icon-seek-first' : 'icon-double-angle-left bigger-150',
        'ui-icon-seek-prev' : 'icon-angle-left bigger-150',
        'ui-icon-seek-next' : 'icon-angle-right bigger-150',
        'ui-icon-seek-end' : 'icon-double-angle-right bigger-150'
    };
    $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function(){
        var icon = $(this);
        var $class = $.trim(icon.attr('class').replace('ui-icon', ''));

        if($class in replacement) icon.attr('class', 'ui-icon '+replacement[$class]);
    })
}

window.onresize = function  _doResize() {
    var ss = pageSize();
    $("#grid-table").jqGrid('setGridWidth', ss.WinW-10).jqGrid('setGridHeight', ss.WinH-200);
}

function pageSize() {
    var winW, winH;
    if(window.innerHeight) {// all except IE
        winW = window.innerWidth;
        winH = window.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
        winW = document.documentElement.clientWidth;
        winH = document.documentElement.clientHeight;
    } else if (document.body) { // other
        winW = document.body.clientWidth;
        winH = document.body.clientHeight;
    }  // for small pages with total size less then the viewport
    return {WinW:winW, WinH:winH};
}

//select2查询列表每次只查数据的前20条

</script>

</body>


</@layout>
